package xin.homeant.framework.httpclient;


import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;


import xin.homeant.framework.httpclient.model.HttpAsyncRequestCallback;
import xin.homeant.framework.httpclient.model.HttpRequest;
import xin.homeant.framework.httpclient.model.HttpResponse;
import xin.homeant.framework.httpclient.model.Verb;

public interface HttpClient {
    String DEFAULT_CONTENT_TYPE = "application/x-www-form-urlencoded";
    String CONTENT_TYPE = "Content-Type";
    String CONTENT_LENGTH = "Content-Length";

    void close() throws IOException;

    <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            byte[] bodyContents, HttpAsyncRequestCallback<T> callback, HttpRequest.ResponseConverter<T> converter);

    <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            String bodyContents, HttpAsyncRequestCallback<T> callback, HttpRequest.ResponseConverter<T> converter);

    <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            File bodyContents, HttpAsyncRequestCallback<T> callback, HttpRequest.ResponseConverter<T> converter);

    HttpResponse execute(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            byte[] bodyContents) throws InterruptedException, ExecutionException, IOException;

    HttpResponse execute(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            String bodyContents) throws InterruptedException, ExecutionException, IOException;

    HttpResponse execute(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
            File bodyContents) throws InterruptedException, ExecutionException, IOException;
}
